﻿package com.dish.biz;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091500518482";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCiLfMf4pCK/8ytSa64UmPueOiGJG854EDKlfJzAdYOGVdhdoKtVpguM80NHODTpptM7WYli5RbFPlI1awTHWNHWdPShuJfEaARaZD1nLbavAPEoyoFNYnCddZBXyXYQPtm1QdeHX6BCni3lXB9/hKGH9cum2gl5zJXtC3dJPtCQBQeLw+3Fy8cIbyM9XDLD/zdzSwIhCzkiyu2RCpgJzcFa9kS4qOMrLSbNsdtJiwvWIup7yxByznXKS3ja3SlANwcpJVjKZooPrRLE33XrpkUlAiOOIvaaMHOoub4StKHx5Yw2DSALV7AkgOLfAzfy+XGfK57OZw9A1v7jo/HL7eHAgMBAAECggEAUEeAluL2++ddsNXNaC5Yiz5Mk8JLUJHiYKXTCvz4saf3qiYYz6cS06QOt5P48qwBKhZFvwYV3PRH5bbnY9rjPvmHMipUugymeJgSCpKVrTbugpLmBQgYdisQcPGhcSfRinifGgZtjYDaer29npB7KOtwAAErj7+fGuz02wgoXAVD8GDuptdPZD+MR65WhWNIpehEAQ/FsbPdOi5VOf1DbPLdVg44zxGzK0LZlwMWtqaGcHF6XRTcL5QnQAF3Z+Tgqr9YisJ7l5UcMwgtQjll7D6yBMu+/lucgOeuAY/+QsNCORr4jPpCSXw2+Qvt/tnU2AIjr9V5oOQVZQImwhMKcQKBgQDa97Gy07G05bLkIPX7X5hc2q5nwHAQuXhub7Ka457WGvqe+vE3cbqoFODdTt1neIJJfmi8zc99ABnUuv3TMvskvexozYkhTOlQVKkr6zfFTMHvzmrBfanTZNRF6Cal9c8OTaqFLVLXa8CFeRZtXKItCyA0fXgdbu8vnyjdV/FMSQKBgQC9m5bFvbdKwhW7tjHFjLj44cW/CggL1mdRfR3K67l1eIeixYW/TOam7uDznNCoaxI5LqCGfbgprDc3Wb4uZ2gHZ++x19maGiJsMSeg95fyF/mhN3PtNY+d0N+QgVtoBljL2A7jVdSDb2BWE7MledY+FFfUu6A65d2EKIILUd3FTwKBgQCsKWQF/nwShyeIRoIhCqB5IVdPK/bwr2MJMbl0HtOb88pphVRzC3B/Bytl1cQuvolxz3n6OLeSyKmGoR9BFyxvTwS5wiC3lgk7p9T7Ow22iwtQyTMWvv7vvq9H56e7hPEvhdE0tNYVmhrc1r/TbKn2UHEZ1CzEt5xIDRPMNID8QQKBgH8Vh8rly7KJv7Ne/KEiHuCBwt62xInanMlbiNp3gIihzpdkuK5txrLgrVnbI2eezEoTXHiITyVvTlsFBZloqas9GMUkna7SEXxeveb/zJHxS9mop0S4f5gRZacfbLqedmm6WNA6uQOXZQSMk6hsrxJQ5EWrtEuFwiFQXUllB7W1AoGAaXwlfxWn3zaPJ9c6j8koVtykjFay9PkXpR2mKCS9AgJYnunJyvHsKLjFNwMR3Wy07t+I+c9B0WV/UszqdwGYVYlmCdTOA1STNLX9AoXc23Pnz0bxV07QlCJuHI5yIqtUyCxdWgexYDbaDSRQjU5si+xJyDc77pnlcNrJJlzSqeU=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmR3hhC7fzFXiXamQot5JCoROet2/BgO6+iG7CfU73nEkoOXkuVgQ5TdEdk5W0zBRj8lfxXjJ0nlr4GloYhILjB4GVfdjC7u+mRhoiCXkD61miuqDfQh8dzzi16HI1MTliEHDIYVq5ofgvo4uTwk6CXSFnTpDVX4J8sstIVHjETagKpG6bnkfcSoz+hKaCApHgLajOAPbhCwLrH0UpctNVfOHBMqc+zH047lidl2aEQWOBV7+Tx+Wc/hm3vH7oNU+tcI1oifjtw/nDluSglzsftwlqXg2Ilj+1sJQYIJTdy0bJ+tIt3irbcGiCmHRBjhnvoLRTJQhN74TtUGqkAQELQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://172.20.45.162:8080/dishorder/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://172.20.45.162:8080/dishorder/return_url.jsp";

	// 签名方式	
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "F:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

